﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GPSCrowdSource.DataStructures {

  /// <summary>
  /// Provides a structure that contains data which describes a radial sample which
  /// consists of:
  /// 
  /// Bin A := A time bin
  /// Bin B := A second time bin
  /// delta := The difference in mean radius between Bin A and Bin B
  /// </summary>
  public struct RadialSample {
    
    /// <summary>
    /// Construct a radial sample element.
    /// </summary>
    public RadialSample(float d, TimeBin a, TimeBin b) : this() {
      Delta = d;
      A = a;
      B = b;
      }

    #region Properties

    /// <summary>
    /// Get/Set the radial delta.
    /// </summary>
    public float Delta { get; set; }
    
    /// <summary>
    /// Get/Set the first time bin that is associated with this
    /// delta.
    /// </summary>
    public TimeBin A { get; set; }

    /// <summary>
    /// Get/Set the second time bin that is associated with this
    /// delta.
    /// </summary>
    public TimeBin B { get; set; }

    #endregion

    public override bool Equals(object obj) {
      RadialSample rs = (RadialSample)obj;
      return rs.A == A && rs.B == B && rs.Delta == Delta;
      }

    public override int GetHashCode() {
      return ToString().GetHashCode();
      }

    public override string ToString() {
      return "A:" + A.ToString() + ", B:" + B.ToString() + ", D:" + Delta;
      }

    }
}
